#pragma once

#include "Msg.h"
#include "Sgn.h"
#include "Worker.h"
#include "stdlis.h"
#include "Singleton.h"
#include "XmlConfigLoader.h"

class Messenger : public GameObject, public Worker, public Singleton<Messenger>, public Lockable, public XmlConfigLoader
{
public:
	DECLARE_XML_CONFIG_LOADER;
	typedef vector<shared_ptr<Msg>> MessageList;
	typedef vector<shared_ptr<Sgn>> SignalList;

	Messenger(void);
	~Messenger(void);
	void AddMessage(shared_ptr<Msg> message);
	void AddSignal(shared_ptr<Sgn> signal);
	virtual HRESULT OnInitSingleton(void);

protected:
	virtual void OnRun(void);

private:
	static void _routine(void * data);
	MessageList _MessageList;
	SignalList _SignalList;
	DECLARE_XML_INTEGER(_SleepDuration);
};

